<script setup lang='ts'>
import { getHeaderData } from "@/api/home/index.ts"
import LineChart from "@/components/Charts/home/lineChart/index.vue"
// import * as echarts from "echarts"
import { reactive } from "vue";
let headerArr: any = reactive([]);
let ygList: any = reactive([])
// 获取头部数据
const getHeaderList = async () => {
    let result: any = await getHeaderData();
    if (result.code == 200) {
        //存储已有的医院的数据
        headerArr.push(...result.data)
        console.log(ygList);
    }
};
getHeaderList()
// 折线图部分

</script>
<template>
    <div class="outter">
        <div class="header">
            <div class="numBox">
                <div class="item" v-for="(item, index) in headerArr" :key="index">
                    <div class="title">{{ item.title }}</div>
                    <div class="num">{{ item.num }}</div>
                </div>
            </div>
            <!-- 天气 -->
            <div class="weather">
                <div class="box">
                    <SvgIcon name="cloud" class="cloud" width="80" height="80"></SvgIcon>
                    <div class="item">
                        <div class="title">多云</div>
                        <div class="num"><span style="font-size: 33px;font-weight: 700;">2</span><span>℃</span></div>
                    </div>
                </div>
                <div class="item">
                    <div class="title">风速</div>
                    <div class="num"><span style="font-size: 33px;font-weight: 700;">16</span><span>m/s</span></div>
                </div>
            </div>
        </div>
        <!-- 中间区域 -->
        <div class="content">
            <div class="left">
                <div class="top">
                    <div class="info">
                        <div class="title">
                            日均发电量
                        </div>
                        <div class="num">3000KW</div>
                    </div>
                    <div class="itemBox">
                        <div class="item">
                            <div class="title">完成发电计划</div>
                            <div class="num">99%</div>
                        </div>
                        <div class="line"></div>
                        <div class="item">
                            <div class="title">预估收益</div>
                            <div class="num">2536820</div>
                        </div>
                        <div class="line"></div>
                        <div class="item">
                            <div class="title">完成发电计划</div>
                            <div class="num">85%</div>
                        </div>
                    </div>
                </div>
                <div class="lineChart">
                    <LineChart></LineChart>
                </div>

            </div>
            <div class="right">
                <div class="title">安全生产预警</div>
                <div class="num"><span style="font-size: 24px;font-weight: 700;">4</span>
                    件</div>

                <ul>
                    <li v-for="item in 10">
                        <div>
                            <div class="time">2023-11-10</div>
                            <div class="code">025电站</div>
                        </div>
                        <div>
                            <div class="type">变压器噪声</div>
                            <div class="tag">一般</div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</template>
 
<style scoped lang="scss">
$fontColor : #555555;
$titleColor: rgba(133, 136, 143, 1);

.outter {
    .header {
        width: 100%;
        height: vh(148);
        display: flex;
        justify-content: space-between;

        .numBox {
            height: 100%;
            display: flex;
            justify-content: space-between;
            width: 70%;

            .item {
                height: 100%;
                width: vw(281);
                background-color: #fff;
                padding: 20px 30px 30px 60px;
                box-sizing: border-box;
                border-radius: 10px;
                box-shadow: rgba(212, 212, 212, 0.1) 0px 7px 29px 0px;

                .title {
                    /** 文本1 */
                    font-size: 16px;
                    font-weight: 400;
                    letter-spacing: 0px;
                    line-height: 40px;
                    color: $titleColor;
                }

                .num {
                    font-size: 26px;
                    font-weight: 700;

                }
            }
        }

        .weather {
            width: 29%;
            border-radius: 10px;
            box-shadow: rgba(212, 212, 212, 0.1) 0px 7px 29px 0px;
            background-color: #fff;
            padding: 30px 70px;
            box-sizing: border-box;
            display: flex;
            justify-content: space-between;
            align-items: center;

            .cloud {
                margin-right: 20px;
                vertical-align: bottom;
                margin-top: 20px;
            }

            .box {
                display: flex;
                align-items: center;
            }

            .item {
                .title {
                    line-height: 40px;
                    color: $titleColor;
                }

                .num {
                    display: flex;


                }
            }
        }
    }

    // 中间区
    .content {
        margin-top: 15px;
        height: vh(400);
        width: 100%;
        display: flex;
        justify-content: space-between;

        .left {
            width: 70%;
            background-color: #fff;
            border-radius: 10px;
            box-shadow: rgba(212, 212, 212, 0.1) 0px 7px 29px 0px;
            padding: 10px 20px;
            box-sizing: border-box;

            .lineChart {
                height: calc(300px - 80px);
            }

            .top {
                display: flex;
                justify-content: space-between;

                .info {
                    text-align: left;

                    .title {
                        font-weight: 700;
                        font-size: 18px;
                        margin-top: 10px;
                    }

                    .num {
                        font-weight: 700;
                        font-size: 34px;
                    }
                }

                .itemBox {
                    display: flex;
                    align-items: center;

                    .item {
                        padding: 0 20px;
                        box-sizing: border-box;

                        .title {
                            color: $titleColor;
                            line-height: 50px;
                        }

                        .num {
                            font-size: 18px;
                            color: #000;
                            font-weight: 700;
                        }

                    }

                    .line {
                        margin-top: 20px;
                        height: 50px;
                        width: 1px;
                        border-right: 1px solid #d7d7d7;
                    }
                }
            }



        }

        .right {
            width: 29%;
            height: 100%;
            background-color: #fff;
            border-radius: 20px;
            box-shadow: rgba(212, 212, 212, 0.1) 0px 7px 29px 0px;
            padding: 10px 20px;
            box-sizing: border-box;

            .title {
                font-weight: 700;
                font-size: 18px;
                margin-top: 10px;
                margin-bottom: 10px;
            }

            .num {
                font-weight: 700;
            }

            ul {
                list-style: none;
                overflow: auto;
                height: calc(100% - 80px);

                li {
                    display: flex;
                    justify-content: space-between;
                    align-items: center;
                    padding: 10px 0;
                    border-bottom: 1px solid #e7e7e7;
                    overflow: auto;

                    div {

                        .time,
                        .code {
                            color: $titleColor;
                            font-size: 16px;
                            line-height: 25px;
                        }
                    }

                    div:last-child {
                        display: flex;
                        align-items: center;

                        .type {
                            margin-right: 10px;
                            font-weight: 500;
                        }

                        .tag {
                            border-radius: 5px;
                            padding: 2px 5px;
                            font-size: 14px;
                            background-color: #f0fbff;
                            color: #686868;
                        }
                    }
                }
            }
        }
    }
}</style>